﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace ConsoleApplication3
{
    class Program
    {
        static int GetMax(int[]a,int n)
        {
            int max=a[0];
            for(int i=0;i< n; i++)
            {
                if (a[i] > max) max = a[i];
            }
            return max;
        }

        static int GetMin(int[] a, int n)
        {
            int min = a[0];
            for (int i = 0; i < n; i++)
            {
                if (a[i] < min) min = a[i];
            }
            return min;
        }

        static int GetSum(int[]a,int n)
        {
            int sum=0;
            for (int i = 0; i < n; i++) sum += a[i];
            return sum;
        }

        static int Getaverge(int[]a,int n)
        {
            return GetSum(a, n) / n;
        }
        static void Main(string[] args)
        {
            while (true)
            {
                Write("请输入数组长度：");
                int n = Int32.Parse(ReadLine());
                int[] arry = new int[n];
                WriteLine("请输入数组元素：");
                for (int i = 0; i < n; i++)
                {
                    arry[i] = Int32.Parse(ReadLine());
                }
                WriteLine("数组最大值：" + GetMax(arry, n));
                WriteLine("数组最小值：" + GetMin(arry, n));
                WriteLine("数组之和：" + GetSum(arry, n));
                WriteLine("数组平均值：" + Getaverge(arry, n));
                WriteLine();
            }
        }
    }
}
